const keyghost = [{
        showname: "主板",
        value: [101, 102, 108],
        jumpname: "JYF9",
        isonline: true,
        detailname: [{
                code: "83",
                name: "上证A股"
            },
            {
                code: "90",
                name: "深证A股"
            }
        ]
    },



    { showname: "港股", value: [105], jumpname: "HKF9", isonline: true },
    { showname: "科创板", value: [107], jumpname: "STIBF9", isonline: true },
    { showname: "三板", value: [103], jumpname: "NQF9", isonline: true },
    {
        showname: "基金",
        value: [201, 202, 203, 204, 205, 206],
        jumpname: "FUNDF9",
        isonline: true,
    },
    {
        showname: "指数",
        value: [301, 302, 303, 304, 305, 306, 307, 309],
        jumpname: "INDEXF9",
        isonline: true,
    },
    {
        showname: "债券",
        value: [
            501,
            502,
            503,
            506,
            504,
            505,
            507,
            508,
            509,
            510,
            511,
            512,
            513,
            514,
            515,
            516,
            518,
            519,
            520,
            521,
            523,
            524,
            526,
            528,
        ],
        jumpname: "BONDF9",
        isonline: true,
    },
    // { "name": "信用债", "value": [504, 505, 507, 508, 509 ,510, 511, 512, 513, 514, 515, 516, 518, 519 ,520, 521, 523, 524 ,526, 528] },
    { showname: "ABS", value: [517], jumpname: "ABSF9", isonline: true },
    {
        showname: "期货",
        value: [610, 611, 612, 613, 614, 615, 620, 630, 640],
        jumpname: "FUTURESF9",
        isonline: true,
    },
];
/**
 * 不支持跳转F9代码集合
 */
export const nonsupportcode = [
    "104",
    "208",
    "401",
    "402",
    "520",
    "522",
    "525",
    "527",
    "7",
    "701",
    "702",
    "703",
    "704",
    "8",
    "801",
    "802",
    "803",
    "804",
    "9",
    "905",
];

/* 根据code返回 市场名称和跳转参数 */
export const f9name = (code, detailcode) => {
    if (code) {
        let obj = { name: "", jumpname: "" };
        for (var i = 0; i < keyghost.length; i++) {
            if (keyghost[i].value.indexOf(parseInt(code)) != -1) {
                obj.name = keyghost[i].showname;
                obj.jumpname = keyghost[i].jumpname;
                obj.isonline = keyghost[i].isonline;
                obj.detailname = keyghost[i].showname;
                if (keyghost[i].detailname && detailcode) {
                    keyghost[i].detailname.map((item, index) => {
                        if (item.code.indexOf(parseInt(detailcode)) != -1) {
                            obj.detailname = item.name;
                        }
                    })
                }


            }
        }
        return obj;
    }
    // return obj;
};

/*  主板F9    101 102 108
    港股F9    105
    科创板F9  107
    三板F9    103
    基金F9    201 202 203 204 205 206
    指数F9    301 302 303 304 305 306 307 309
    利率债F9  501 502 503 506
    信用债F9  504 505 507 508 509 510 511 512 513 514 515 516 518 519 520 521 523 524 526 528
    ABS       517
    商品期货  610 611 612 613 614 615
    货币期货  620
    利率期货  630
    股指期货  640 */